package com.it.a05threadmethod2;

public class ThreadDemo {
    public static void main(String[] args) {
        /*
            setPriority(int newPriority)    设置线程的优先级
            final int getpriority()         获取线程的优先级
         */
        //创建线程要执行的参数对象
        MyThread mr = new MyThread();
        //创建线程对象
        Thread t1 = new Thread(mr,"飞机");
        Thread t2 = new Thread(mr,"坦克");
        //优先级越高，抢到CPU的概率就越高（但只是概率）
        t1.setPriority(1);
        t2.setPriority(10);

        t1.start();
        t2.start();
    }
}
